<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>My Engine: my::StopWatch Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">My Engine
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><b>my</b>      </li>
      <li class="navelem"><a class="el" href="classmy_1_1_stop_watch.html">StopWatch</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">my::StopWatch Class Reference</div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="my::StopWatch" -->
<p>Create a stoppable watch, used for timers or to handle time, animations, etc...  
 <a href="classmy_1_1_stop_watch.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_stop_watch_8h_source.html">StopWatch.h</a>&gt;</code></p>

<p><a href="classmy_1_1_stop_watch-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0aa9eca89de9e912c302682ae211b35a"></a><!-- doxytag: member="my::StopWatch::StopWatch" ref="a0aa9eca89de9e912c302682ae211b35a" args="(bool initrunning=false)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmy_1_1_stop_watch.html#a0aa9eca89de9e912c302682ae211b35a">StopWatch</a> (bool initrunning=false)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classmy_1_1_stop_watch.html" title="Create a stoppable watch, used for timers or to handle time, animations, etc...">StopWatch</a> constructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a40f3e207003bcafab62697c05fd64df1"></a><!-- doxytag: member="my::StopWatch::~StopWatch" ref="a40f3e207003bcafab62697c05fd64df1" args="()" -->
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmy_1_1_stop_watch.html#a40f3e207003bcafab62697c05fd64df1">~StopWatch</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Virtual default destructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmy_1_1_stop_watch.html#a69adefd6a80619469ca878dfefb60c00">getElapsedTime</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the elapsed time since the start or last reset, time is in SECONDS.  <a href="#a69adefd6a80619469ca878dfefb60c00"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmy_1_1_stop_watch.html#a72c383a5c28ade1a07bfcde8c9e94e2d">isRunning</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Is the <a class="el" href="classmy_1_1_stop_watch.html" title="Create a stoppable watch, used for timers or to handle time, animations, etc...">StopWatch</a> running ?  <a href="#a72c383a5c28ade1a07bfcde8c9e94e2d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1c5ea02095beadf165c0f783b40a90a5"></a><!-- doxytag: member="my::StopWatch::start" ref="a1c5ea02095beadf165c0f783b40a90a5" args="()" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmy_1_1_stop_watch.html#a1c5ea02095beadf165c0f783b40a90a5">start</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Start the <a class="el" href="classmy_1_1_stop_watch.html" title="Create a stoppable watch, used for timers or to handle time, animations, etc...">StopWatch</a>. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3bffbfc8dcc053f3c3eb0ab18a87f967"></a><!-- doxytag: member="my::StopWatch::stop" ref="a3bffbfc8dcc053f3c3eb0ab18a87f967" args="()" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmy_1_1_stop_watch.html#a3bffbfc8dcc053f3c3eb0ab18a87f967">stop</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Stop the <a class="el" href="classmy_1_1_stop_watch.html" title="Create a stoppable watch, used for timers or to handle time, animations, etc...">StopWatch</a>. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmy_1_1_stop_watch.html#a5a7a43935ae1e82344db132858f932ee">reset</a> (bool stillrunning=false)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Reset the <a class="el" href="classmy_1_1_stop_watch.html" title="Create a stoppable watch, used for timers or to handle time, animations, etc...">StopWatch</a>.  <a href="#a5a7a43935ae1e82344db132858f932ee"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Create a stoppable watch, used for timers or to handle time, animations, etc... </p>
<div class="fragment"><pre class="fragment"><a class="code" href="classmy_1_1_stop_watch.html" title="Create a stoppable watch, used for timers or to handle time, animations, etc...">my::StopWatch</a> clock; <span class="comment">// Create a stoppable clock</span>
clock.<a class="code" href="classmy_1_1_stop_watch.html#a1c5ea02095beadf165c0f783b40a90a5" title="Start the StopWatch.">start</a>(); <span class="comment">// Start the clock</span>
<span class="keywordflow">while</span>(<span class="keyword">true</span>)
{
    <span class="comment">// Do something...</span>

    <span class="comment">// This code is useless and ugly, but it&#39;s a demonstration :</span>
    <span class="keywordflow">if</span>(!clock.<a class="code" href="classmy_1_1_stop_watch.html#a72c383a5c28ade1a07bfcde8c9e94e2d" title="Is the StopWatch running ?">isRunning</a>())
        clock.<a class="code" href="classmy_1_1_stop_watch.html#a5a7a43935ae1e82344db132858f932ee" title="Reset the StopWatch.">reset</a>(<span class="keyword">true</span>);   <span class="comment">// Reset the clock and restart it</span>

    <span class="keywordflow">if</span>(clock.<a class="code" href="classmy_1_1_stop_watch.html#a69adefd6a80619469ca878dfefb60c00" title="Return the elapsed time since the start or last reset, time is in SECONDS.">getElapsedTime</a>() &gt; 1.f)    <span class="comment">// If elapsed time is bigger than 1 sec</span>
        clock.<a class="code" href="classmy_1_1_stop_watch.html#a3bffbfc8dcc053f3c3eb0ab18a87f967" title="Stop the StopWatch.">stop</a>();
}
</pre></div> </div><hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a69adefd6a80619469ca878dfefb60c00"></a><!-- doxytag: member="my::StopWatch::getElapsedTime" ref="a69adefd6a80619469ca878dfefb60c00" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">float my::StopWatch::getElapsedTime </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Return the elapsed time since the start or last reset, time is in SECONDS. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Elapsed time in SECONDS </dd></dl>

</div>
</div>
<a class="anchor" id="a72c383a5c28ade1a07bfcde8c9e94e2d"></a><!-- doxytag: member="my::StopWatch::isRunning" ref="a72c383a5c28ade1a07bfcde8c9e94e2d" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool my::StopWatch::isRunning </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Is the <a class="el" href="classmy_1_1_stop_watch.html" title="Create a stoppable watch, used for timers or to handle time, animations, etc...">StopWatch</a> running ? </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if it's running </dd></dl>

</div>
</div>
<a class="anchor" id="a5a7a43935ae1e82344db132858f932ee"></a><!-- doxytag: member="my::StopWatch::reset" ref="a5a7a43935ae1e82344db132858f932ee" args="(bool stillrunning=false)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void my::StopWatch::reset </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>stillrunning</em> = <code>false</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Reset the <a class="el" href="classmy_1_1_stop_watch.html" title="Create a stoppable watch, used for timers or to handle time, animations, etc...">StopWatch</a>. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">stillrunning</td><td>If true, the <a class="el" href="classmy_1_1_stop_watch.html" title="Create a stoppable watch, used for timers or to handle time, animations, etc...">StopWatch</a> will keep running, by default it stops ! </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>Time/<a class="el" href="_stop_watch_8h_source.html">StopWatch.h</a></li>
<li>StopWatch.cpp</li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Fri Nov 18 2011 22:34:34 for My Engine by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
